﻿@using Newtouch.Common.Operator;
@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
    var opeator = OperatorProvider.GetCurrent();
}


<form id="form1">
    <table class="form" style="width:100%">
        <tbody>
            <tr>
                <th class="formTitle" style="width:40px;padding-right:0px">姓名：</th>
                <td class="formValue" style="width:80px">
                    <input id="PatName" name="PatName" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:60px;padding-right:0px">住院号：</th>
                <td class="formValue" style="width:80px">
                    <input id="Zyh" name="zyh" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:40px;padding-right:0px">床号：</th>
                <td class="formValue" style="width:80px">
                    <input id="Bed" name="Bed" type="text" class="form-control" readonly="readonly" />
                </td>

            </tr>
            <tr>
                <th class="formTitle" style="width:40px;padding-right:0px">申请科室：</th>
                <td class="formValue" style="width:80px">
                    <input id="ApplyDeptName" name="ApplyDeptName" type="text" class="form-control" readonly="readonly" />
                    <input hidden="hidden" id="ApplyDept" name="ApplyDept" />
                    <input hidden="hidden" id="bllx" name="bllx" />
                </td>
                <th class="formTitle" style="width:40px;padding-right:0px">申请医师：</th>
                <td class="formValue" style="width:80px">
                    <input id="ApplyDoctorName" name="ApplyDoctorName" type="text" class="form-control" readonly="readonly" />
                    <input hidden="hidden" id="ApplyDoctor" name="ApplyDoctor" />
                </td>
                <th class="formTitle" style="width:60px;padding-right:0px">申请类型：</th>
                <td class="formValue" style="width:80px">
                    <select id="ApplyType" name="ApplyType" class="form-control required">
                        <option value="0">新建病历</option>
                        <option value="1">修改病历</option>
                    </select>
                </td>

            </tr>
            <tr>
                <th class="formTitle" style="width:40px;padding-right:0px">申请病历名称：</th>
                <td class="formValue" style="width:80px">
                    <input id="MedicalName" name="MedicalName" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:40px;padding-right:0px">病历质控完成时间：</th>
                <td class="formValue" style="width:80px">
                    <input id="CompletionDate" name="CompletionDate" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:40px;padding-right:0px">申请完成时间：</th>
                <td class="formValue" style="width:80px">
                    <input id="ApplyCompletionDate" name="ApplyCompletionDate" type="text" class="form-control input-wdatepicker required" style="float:left;" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" style="width:60px;padding-right:0px"><span class="required">*</span>申请原因：</th>
                <td class="formValue" style="width:80px">
                    <input id="ApplyReason" name="ApplyReason" type="text" class="form-control required" />
                </td>
            </tr>

        </tbody>
    </table>
</form>
<script>
    var zyh = $.request("zyh");
    var xm = $.request("xm");
    var ch = $.request("ch");
    var bllx = $.request("bllx");
    var sqblmc = $.request("sqblmc");
    var blzkwcsj = $.request("zkwcsj");
    var Ryrq = $.request("Ryrq");
    var Cyrq = $.request("Cyrq");

    $(function () {
        $("#PatName").val(xm);
        $("#Bed").val(ch);
        $("#Zyh").val(zyh);
        $("#MedicalName").val(sqblmc);
        $("#CompletionDate").val(blzkwcsj);
        $("#ApplyDeptName").val('@opeator.DepartmentName');
        $("#ApplyDept").val('@opeator.DepartmentCode');
        $("#ApplyDoctorName").val('@opeator.UserName');
        $("#ApplyDoctor").val('@opeator.UserCode');
        $("#bllx").val(bllx);
    })

    function submitForm() {
        debugger;
        if (!$('#form1').formValid()) {
            return false;
        }
        var postData = $("#form1").formSerialize();
        postData["Ryrq"] = Ryrq;
        postData["Cyrq"] = Cyrq;
        $.submitForm({
            url: "/MedicalRecordManage/PatInfo/SubmitForm",
            param: postData,
            success: function (res) {
                $.modalAlert(res.message, res.state);
            }
        });
    }
</script>